package Utils;


import androidx.recyclerview.widget.RecyclerView;

/**
 * Created by ziyingzhu on 2017/3/16.
 */
public abstract class OnLoadMoreListener<LinearLayoutManager> extends RecyclerView.OnScrollListener {

    private LinearLayoutManager layoutManager;
    private int lastPosition, lastItemCount;
    public static int itemCount =0;
    public abstract void onLoadMore();

    @Override
    public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
//        if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
//            layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
//            itemCount = layoutManager.getItemCount();
//            lastPosition = layoutManager.findLastCompletelyVisibleItemPosition();
//        } else {
//            return;
//        }
//
//        if (lastItemCount != itemCount && lastPosition == itemCount - 1) {
//            lastItemCount = itemCount;
//            this.onLoadMore();
//        }
    }
}
